package com.example.hotel_lxy.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.hotel_lxy.R;
import com.example.hotel_lxy.application.ARouterPath;
import com.example.hotel_lxy.utils.SPUtils;
import com.ysxsoft.common_base.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 设置
 */
@Route(path = "/main/SetUpActivity")
public class SetUpActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.text_helpcenter)
    TextView textHelpcenter;
    @BindView(R.id.text_changepassword)
    TextView textChangepassword;
    @BindView(R.id.text_wechat)
    TextView textWechat;
    @BindView(R.id.about)
    TextView about;
    @BindView(R.id.text_switchaccounts)
    TextView textSwitchaccounts;
    @BindView(R.id.edit_app)
    TextView editApp;


    public static void start() {
        ARouter.getInstance().build(ARouterPath.getSetUpActivity())
                .navigation();
    }


    @Override
    protected int getLayoutId() {
        return R.layout.activity_set_up;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @Override
    public void doWork() {
        super.doWork();
        back.setOnClickListener(this);
        textHelpcenter.setOnClickListener(this);
        textChangepassword.setOnClickListener(this);
        textWechat.setOnClickListener(this);
        about.setOnClickListener(this);
        textSwitchaccounts.setOnClickListener(this);
        editApp.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.text_helpcenter://帮助中心
                HelpCenterActivity.start();
                break;
            case R.id.text_changepassword://修改密码
                ChangePasswordActivity.start();
                break;
            case R.id.text_wechat://官方微信
                OfficialWeChatActivity.start();
                break;
            case R.id.about://关于我们
                AboutActivity.start();
                break;
            case R.id.text_switchaccounts:
                SwitchAccountsActivity.start();
                finish();
                break;
            case R.id.edit_app:
                SPUtils.put(SetUpActivity.this,"token","");
                SPUtils.put(SetUpActivity.this, "id", "");
                Intent intent = new Intent(SetUpActivity.this,LoginActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                finish();
                break;
        }
    }
}